require 'erb'
require 'common/base'

class SNMPBase < Base

  attr_accessor :step, :transport, :base_options, :base_transports, :base_variables, :message, :asn1_object_identifier, :request_id

  def initialize(step, filename, params = {}, transport="SNMP")
    super()
    @transport = transport
    @step = step
    @asn1_object_identifier = params["asn1_object_identifier"] or "1.3.6.1.2.1.1.5.0"
    @request_id = params["request_id"].to_i or 321544480
    
    @base_options = "
     $asn1_object_identifier='<%= @asn1_object_identifier %>'
     $request_id='<%= @request_id %>'"

    @base_variables = ''

    @base_transports = 'SNMP = udp(dst_port: 161)'

    if !filename.nil?
      template = get_message("SNMP", filename)
      erb = ERB.new(template, 0, '%<>')
      @message = erb.result(binding)
    end
  end

end
